﻿<div ng-controller="mailsController as ctrl">
    <accordion-group is-open="true" >
        <accordion-heading>
            Related Emails ({{ ctrl.emails.length }})
        </accordion-heading>
        <div ng-repeat="mail in ctrl.emails">
            <div class="list-group">
                <a href class="list-group-item active" ng-click="showDetails = ! showDetails">
                    <h4 class="list-group-item-heading">{{mail.Subject}}</h4>
                    <p class="list-group-item-text">{{mail.DateTimeSent | date:'dd/MM/yyyy h:mma'}} | {{mail.From.EmailAddress.Address}} </p>
                    <div class="mail-wrap" ng-click="toggleView" ng-show="showDetails" ng-bind-html="mail.Body.Content | to_trusted">
                        {{mail.Body.Content}}
                    </div>
                </a>
            </div>
        </div>
    </accordion-group>
</div>
